package com.wx.chapter14.list_;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/7/27 - 21:41
 */
public class ListMethod {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("张三丰");
        list.add("贾宝玉");
//        list.add(1, "hsp");
//        System.out.println(list);

        List list2 = new ArrayList();
        list2.add("jack");
        list2.add("tom");
        list.addAll(1, list2);
        System.out.println(list);
        System.out.println(list2.indexOf("tom"));
        System.out.println(list2.lastIndexOf("tom"));
//        list2.remove("tom");
        list2.set(1, "asa");
        System.out.println(list2.lastIndexOf("tom"));
        List list3 = list2.subList(0, 1);//前合后开
        System.out.println(list3);
    }
}
